package com.tarena.lbs.business.dao.repository.ipml;

import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.business.dao.mapper.StoreMapper;
import com.tarena.lbs.business.dao.repository.StoreRepository;
import com.tarena.lbs.business.pojo.param.StoreParam;
import com.tarena.lbs.business.pojo.po.StorePO;
import com.tarena.lbs.business.pojo.query.AreaStoreQuery;
import com.tarena.lbs.business.pojo.query.StoreQuery;
import com.tarena.lbs.business.pojo.vo.StoreVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Slf4j
@Repository
public class StoreRepositoryImpl implements StoreRepository {
    @Autowired
    private StoreMapper storeMapper;



    @Override
    public List<StorePO> list(StoreQuery query) {
        List<StorePO> list = storeMapper.list(query);
        return list;
    }

    @Override
    public void add(StorePO storePO) {
        storeMapper.insert(storePO);
    }

    @Override
    public PageResult<StoreVO> getStoreByCity(AreaStoreQuery query) {
        return storeMapper.selectBycity();
    }

    @Override
    public void location(StoreVO locationPO) {
        storeMapper.location(locationPO);
    }

    @Override
    public int delete(Integer id) {
        log.debug("删除店铺{}", id);
        return storeMapper.delete(id);
    }

    @Override
    public int updateStatus(Integer id, Integer status) {
        return  storeMapper.updateStatus(id,status);
    }
}
